package de.hhbk.feedbackmodul.entities;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the user database table.
 * 
 */
@Entity
@Table(name="user")
public class User implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique=true, nullable=false, length=10)
	private String id;

	@Column(length=30)
	private String name;

	@Column(length=30)
	private String passwort;

	@Column(length=30)
	private String vorname;
	
	@Column(length=50)
	private String email;

	//bi-directional many-to-one association to Frage
	@OneToMany(mappedBy="user",fetch=FetchType.EAGER)
	private Set<Question> frages = new HashSet<Question>();

	//bi-directional many-to-one association to Umfrage
	@OneToMany(mappedBy="user",fetch=FetchType.EAGER)
	private Set<Survey> umfrages = new HashSet<Survey>();

	//bi-directional many-to-one association to Benutzerrolle
    @ManyToOne
	@JoinColumn(name="fk_benutzerrolle")
	private UserRole benutzerrolle;

    public User() {
    }

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPasswort() {
		return this.passwort;
	}

	public void setPasswort(String passwort) {
		this.passwort = passwort;
	}

	public String getVorname() {
		return this.vorname;
	}

	public void setVorname(String vorname) {
		this.vorname = vorname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Set<Question> getFrages() {
		return this.frages;
	}

	public void setFrages(Set<Question> frages) {
		this.frages = frages;
	}
	
	public Set<Survey> getUmfrages() {
		return this.umfrages;
	}

	public void setUmfrages(Set<Survey> umfrages) {
		this.umfrages = umfrages;
	}
	
	public UserRole getBenutzerrolle() {
		return this.benutzerrolle;
	}

	public void setBenutzerrolle(UserRole benutzerrolle) {
		this.benutzerrolle = benutzerrolle;
	}
	
}